package net.skyedu.service;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.skyedu.dao.AjaxDAO;

public class UpdateRollOut extends HttpServlet{
	public void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
		doPost(request, response);
	}
	public void doPost(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
		
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		PrintWriter out = response.getWriter();
		try
		{
		int studentId = Integer.parseInt(request.getParameter("stuid"));
		int courseid = Integer.parseInt(request.getParameter("courseid"));
		int terid = Integer.parseInt(request.getParameter("terid"));
		int deptid=Integer.parseInt(request.getParameter("deptid"));
		double rollout=Double.parseDouble(request.getParameter("rollout"));
		AjaxDAO ajaxDAO = new AjaxDAO();
		int num=ajaxDAO.update(studentId, courseid, terid, deptid,rollout);
		if(num>0)
		{
			out.print("true");
		}
		else
		{
			out.print("false");
		}
		}
		catch(Exception ex)
		{
			out.print("false");
		}
		out.flush();
		out.close();
		
	}

}
